
risk <- xmlOutputDOM()
for (s in 1:length(RiskTable$Scale)) {
  
  risk$addTag("Scale",as.character(RiskTable$Scale[s]))
  
  for (a in 1:length(RiskTable$Alpha)) {
    
    risk$addTag("Alpha",as.character(RiskTable$Alpha[a]))
    
    for (rr in 1:length(RiskTable$RecertRate)) {
      
      risk$addTag("Rate",as.character(RiskTable$RecertRate[rr]))
        risk$addTag("Cost",as.character(RiskTable$RiskCost[s,a,rr])); risk$closeTag()
        risk$addTag("Conf",as.character(RiskTable$RiskConf[s,a,rr])); risk$closeTag()
      risk$closeTag()
    }
    risk$closeTag()
  }
  risk$closeTag()
}
risk$closeTag()
saveXML(risk,file="RiskTableXML.xml")